feat(cli): forward monitor tracker options - #1275
Conversation
|
Hello, thanks for the contribution. Can you keep our PR template ? |
Signed-off-by: Loi Nguyen <vanloi999@gmail.com>
060a21e to
a3ede3f
Compare
|
Updated the PR description to the complete repository template, including the required 🟠 AI-generated disclosure. I personally reviewed and tested every submitted line, understand the implementation, and can explain and support it through review and after merge. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1275 +/- ##
==========================================
- Coverage 89.70% 89.63% -0.07%
==========================================
Files 48 48
Lines 4778 4825 +47
==========================================
+ Hits 4286 4325 +39
- Misses 492 500 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| codecarbon = typer.Typer(no_args_is_help=True) | ||
|
|
||
|
|
||
| def _tracker_option_types() -> dict[str, object]: |
There was a problem hiding this comment.
Can you move those functions below the main one ? It might also be interesting to just move them to another file and import them, this file starts to get big & diverse.
| "measure_power_secs": measure_power_secs, | ||
| "api_call_interval": api_call_interval, | ||
| "log_level": log_level, | ||
| **extra_tracker_args, |
There was a problem hiding this comment.
Not a fan of flexible arguments passing, even if it includes some lag with the tracker's supported arguments list I prefer that we have all of them listed here. Can you set them explicitely ?
Description
Forward tracker constructor options passed to
codecarbon monitor, including--pueand--allow-multiple-runs. Accepted option names are derived fromBaseEmissionsTracker.__init__so the CLI continues to recognize future scalar tracker options. CLI coverage verifies typed float and boolean forwarding.Related Issue
Fixes #1273
Motivation and Context
The monitor command accepted tracker configuration but did not forward several supported constructor options. This made CLI monitoring behave differently from direct tracker use.
How Has This Been Tested?
uv run python -m pytest tests/cli/test_cli_main.py -quv run ruff check codecarbon/cli/main.py tests/cli/test_cli_main.pyuv run ruff format --check codecarbon/cli/main.py tests/cli/test_cli_main.pyuv run mypy codecarbon/cli/main.pyis currently blocked by 285 existing type errors across 19 project modules.Screenshots (if appropriate):
Not applicable.
Types of changes
AI Usage Disclosure
OpenAI Codex assisted with implementation and test preparation. I personally reviewed and tested every submitted line, understand the implementation, and can explain and maintain it.
Checklist: